import request from "@/utils/request.js";


// 获取所有商品分类列表信息
export function getCateListAjax() {
    return request.get("categories");
}

// 根据所选分类的id 和当前所处的面板获取对应的数据
export function getTabsDataAjax(id,sel) {
  return request.get(`categories/${id}/attributes`,{
    params:{
      sel:sel
    }
  });
}

// 点击添加属性或者参数
export function getAddParamsAjax(id,data) {
  return request.post(`categories/${id}/attributes`,data);
}

// 点击 修改 编辑对话框
export function showEditDialogAjax(attr_id,cateid,activeName) {
  return request.get(`categories/${cateid}/attributes/${attr_id}`,{
    params:{
      attr_sel:activeName
    }
  });
}

// 点击修改 参数对话框
export function editParamsAjax(attr_id,cateid,attr_name,attr_sel) {
  return request.put(`categories/${cateid}/attributes/${attr_id}`,{
      attr_name: attr_name,
      attr_sel: attr_sel
  });
}


// 点击删除属性
export function getRemoveAjax(cateId,attr_id) {
  return request.delete(`categories/${cateId}/attributes/${attr_id}`);
}

// 点击添加参数文本
export function getPushInputAjax(cateId,attr_id,data) {
  return request.put(`categories/${cateId}/attributes/${attr_id}`,data);
}








